package com.swpu.spring_mybatis.controller;

import com.swpu.spring_mybatis.pojo.Student;
import com.swpu.spring_mybatis.pojo.dto.StudentDto;
import com.swpu.spring_mybatis.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

import javax.xml.transform.Result;
import java.util.ArrayList;
import java.util.List;

@RestController
public class StudentController {
    @Autowired
    StudentService studentService;

    @PostMapping("/getlist")
    public List<Student> getList(){

            return studentService.getList();

    }
    @PostMapping("/add")
    public Integer addStudent(@RequestBody Student student){
        
        return studentService.addStudent(student);
    }
    @PostMapping("/update")
    public Integer updateStudent(@RequestBody Student student){
        return studentService.updateStudent(student);
    }
    @PostMapping("/delete")
    public Integer deleteStudent(@RequestParam String stuNo){
        return studentService.deleteStudent(stuNo);
    }
}
